\(\int \frac {1}{(a+a \sin (x))^2} \, dx\) [16]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 8, antiderivative size = 33 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {\cos (x)}{3 (a+a \sin (x))^2}-\frac {\cos (x)}{3 \left (a^2+a^2 \sin (x)\right )} \]

[Out]

-1/3*cos(x)/(a+a*sin(x))^2-1/3*cos(x)/(a^2+a^2*sin(x))

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {2729, 2727} \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {\cos (x)}{3 \left (a^2 \sin (x)+a^2\right )}-\frac {\cos (x)}{3 (a \sin (x)+a)^2} \]

[In]

Int[(a + a*Sin[x])^(-2),x]

[Out]

-1/3*Cos[x]/(a + a*Sin[x])^2 - Cos[x]/(3*(a^2 + a^2*Sin[x]))

Rule 2727

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + d*x]/(d*(b + a*Sin[c + d*x])), x]
/; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b^2, 0]

Rule 2729

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*Cos[c + d*x]*((a + b*Sin[c + d*x])^n/(a*d
*(2*n + 1))), x] + Dist[(n + 1)/(a*(2*n + 1)), Int[(a + b*Sin[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d},
 x] && EqQ[a^2 - b^2, 0] && LtQ[n, -1] && IntegerQ[2*n]

Rubi steps \begin{align*} \text {integral}& = -\frac {\cos (x)}{3 (a+a \sin (x))^2}+\frac {\int \frac {1}{a+a \sin (x)} \, dx}{3 a} \\ & = -\frac {\cos (x)}{3 (a+a \sin (x))^2}-\frac {\cos (x)}{3 \left (a^2+a^2 \sin (x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.94 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {-3+4 \cos (x)+\cos (2 x)-4 \sin (x)+\sin (2 x)}{6 a^2 (1+\sin (x))^2} \]

[In]

Integrate[(a + a*Sin[x])^(-2),x]

[Out]

-1/6*(-3 + 4*Cos[x] + Cos[2*x] - 4*Sin[x] + Sin[2*x])/(a^2*(1 + Sin[x])^2)

Maple [A] (verified)

Time = 0.33 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.73

method result size
parallelrisch \(\frac {-2+\tan \left (x \right )+2 \tan \left (x \right ) \left (\sec ^{2}\left (x \right )\right )-2 \left (\sec ^{3}\left (x \right )\right )}{3 a^{2}}\) \(24\)
risch \(-\frac {2 i \left (i+3 \,{\mathrm e}^{i x}\right )}{3 \left ({\mathrm e}^{i x}+i\right )^{3} a^{2}}\) \(27\)
default \(\frac {\frac {2}{\left (\tan \left (\frac {x}{2}\right )+1\right )^{2}}-\frac {2}{\tan \left (\frac {x}{2}\right )+1}-\frac {4}{3 \left (\tan \left (\frac {x}{2}\right )+1\right )^{3}}}{a^{2}}\) \(35\)
norman \(\frac {-\frac {2 \tan \left (\frac {x}{2}\right )}{a}-\frac {2 \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{a}-\frac {4}{3 a}}{a \left (\tan \left (\frac {x}{2}\right )+1\right )^{3}}\) \(39\)

[In]

int(1/(a+a*sin(x))^2,x,method=_RETURNVERBOSE)

[Out]

1/3*(-2+tan(x)+2*tan(x)*sec(x)^2-2*sec(x)^3)/a^2

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 58, normalized size of antiderivative = 1.76 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=\frac {\cos \left (x\right )^{2} + {\left (\cos \left (x\right ) - 1\right )} \sin \left (x\right ) + 2 \, \cos \left (x\right ) + 1}{3 \, {\left (a^{2} \cos \left (x\right )^{2} - a^{2} \cos \left (x\right ) - 2 \, a^{2} - {\left (a^{2} \cos \left (x\right ) + 2 \, a^{2}\right )} \sin \left (x\right )\right )}} \]

[In]

integrate(1/(a+a*sin(x))^2,x, algorithm="fricas")

[Out]

1/3*(cos(x)^2 + (cos(x) - 1)*sin(x) + 2*cos(x) + 1)/(a^2*cos(x)^2 - a^2*cos(x) - 2*a^2 - (a^2*cos(x) + 2*a^2)*
sin(x))

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 134 vs. \(2 (31) = 62\).

Time = 0.31 (sec) , antiderivative size = 134, normalized size of antiderivative = 4.06 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=- \frac {6 \tan ^{2}{\left (\frac {x}{2} \right )}}{3 a^{2} \tan ^{3}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan {\left (\frac {x}{2} \right )} + 3 a^{2}} - \frac {6 \tan {\left (\frac {x}{2} \right )}}{3 a^{2} \tan ^{3}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan {\left (\frac {x}{2} \right )} + 3 a^{2}} - \frac {4}{3 a^{2} \tan ^{3}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan ^{2}{\left (\frac {x}{2} \right )} + 9 a^{2} \tan {\left (\frac {x}{2} \right )} + 3 a^{2}} \]

[In]

integrate(1/(a+a*sin(x))**2,x)

[Out]

-6*tan(x/2)**2/(3*a**2*tan(x/2)**3 + 9*a**2*tan(x/2)**2 + 9*a**2*tan(x/2) + 3*a**2) - 6*tan(x/2)/(3*a**2*tan(x
/2)**3 + 9*a**2*tan(x/2)**2 + 9*a**2*tan(x/2) + 3*a**2) - 4/(3*a**2*tan(x/2)**3 + 9*a**2*tan(x/2)**2 + 9*a**2*
tan(x/2) + 3*a**2)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 74 vs. \(2 (29) = 58\).

Time = 0.20 (sec) , antiderivative size = 74, normalized size of antiderivative = 2.24 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {2 \, {\left (\frac {3 \, \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {3 \, \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 2\right )}}{3 \, {\left (a^{2} + \frac {3 \, a^{2} \sin \left (x\right )}{\cos \left (x\right ) + 1} + \frac {3 \, a^{2} \sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (x\right )^{3}}{{\left (\cos \left (x\right ) + 1\right )}^{3}}\right )}} \]

[In]

integrate(1/(a+a*sin(x))^2,x, algorithm="maxima")

[Out]

-2/3*(3*sin(x)/(cos(x) + 1) + 3*sin(x)^2/(cos(x) + 1)^2 + 2)/(a^2 + 3*a^2*sin(x)/(cos(x) + 1) + 3*a^2*sin(x)^2
/(cos(x) + 1)^2 + a^2*sin(x)^3/(cos(x) + 1)^3)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.88 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {2 \, {\left (3 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 3 \, \tan \left (\frac {1}{2} \, x\right ) + 2\right )}}{3 \, a^{2} {\left (\tan \left (\frac {1}{2} \, x\right ) + 1\right )}^{3}} \]

[In]

integrate(1/(a+a*sin(x))^2,x, algorithm="giac")

[Out]

-2/3*(3*tan(1/2*x)^2 + 3*tan(1/2*x) + 2)/(a^2*(tan(1/2*x) + 1)^3)

Mupad [B] (verification not implemented)

Time = 5.64 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.88 \[ \int \frac {1}{(a+a \sin (x))^2} \, dx=-\frac {2\,\left (3\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2+3\,\mathrm {tan}\left (\frac {x}{2}\right )+2\right )}{3\,a^2\,{\left (\mathrm {tan}\left (\frac {x}{2}\right )+1\right )}^3} \]

[In]

int(1/(a + a*sin(x))^2,x)

[Out]

-(2*(3*tan(x/2) + 3*tan(x/2)^2 + 2))/(3*a^2*(tan(x/2) + 1)^3)